<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class="form-group">
    <label class="col-sm-2 control-label">附件:</label>
    <div class="col-sm-7">
        <input id="myfile" type="file" style="display: none" multiple>
        <!--显示上传的文件名字-->
        <input type="text" id="FileCover" class="form-control" readonly="true">
    </div>
    <div class="col-sm-1">
        <button class="btn btn-primary btn-sm " type="button" onclick="$('input[id=myfile]').click();">
            <i class="fa fa-folder-open" id="browse">&nbsp;&nbsp;浏览</i>
        </button>
    </div>
    <div class="col-sm-1">
        <button class="btn btn-primary btn-sm " type="button" onclick="MyUpload()">
            <i class="fa fa-send" id="upload_status">&nbsp;&nbsp;上传</i>
        </button>
    </div>
</div>
<script>
    $('input[id=myfile]').change(function () {
        var myfiles = document.getElementById("myfile").files;
        var file_index = 0;
        var file_len = myfiles.length;
        var myfilename = null;
        while (file_index < file_len) {
            myfilename = myfilename + myfiles[file_index].name + ";";
            file_index = file_index + 1;
        }
        //console.log(myfiles);
        //$('#FileCover').val($(this).val());
        $('#FileCover').val(myfilename);
        //拼接上传的文件名字并返回到FileCover
    })
</script>

</body>
</html>